Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Cyrus–Beck algorithm</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Cyrus%E2%80%93Beck_algorithm"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Cyrus–Beck_algorithm rootpage-Cyrus–Beck_algorithm skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Cyrus–Beck algorithm</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">

<p>In <a href="Computer_graphics" title="Computer graphics">computer graphics</a>, the <b>Cyrus–Beck algorithm</b> is a generalized <a href="Algorithm" title="Algorithm">algorithm</a> for <a href="Line_clipping" title="Line clipping">line clipping</a>. It was designed to be more efficient than the <a href="Cohen%E2%80%93Sutherland_algorithm" title="Cohen–Sutherland algorithm">Cohen–Sutherland algorithm</a>, which uses repetitive clipping.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> Cyrus–Beck is a general algorithm and can be used with a <a href="Convex_polygon" title="Convex polygon">convex polygon</a> clipping window, unlike Cohen-Sutherland, which can be used only on a rectangular clipping area.
</p><p>Here the <a href="Parametric_equation" title="Parametric equation">parametric equation</a> of a line in the view plane is
<span class="mwe-math-element mwe-math-element-block"><span class="mwe-math-mathml-display mwe-math-mathml-a11y" style="display: none;"><math display="block" xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \mathbf {p} (t)=t\mathbf {p} _{1}+(1-t)\mathbf {p} _{0}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">p</mi>
</mrow>
<mo stretchy="false">(</mo>
<mi>t</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mi>t</mi>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">p</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>1</mn>
</mrow>
</msub>
<mo>+</mo>
<mo stretchy="false">(</mo>
<mn>1</mn>
<mo>−<!-- − --></mo>
<mi>t</mi>
<mo stretchy="false">)</mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">p</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mn>0</mn>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \mathbf {p} (t)=t\mathbf {p} _{1}+(1-t)\mathbf {p} _{0}}</annotation>
</semantics>
</math></span></span>
where <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 0\leq t\leq 1}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mn>0</mn>
<mo>≤<!-- ≤ --></mo>
<mi>t</mi>
<mo>≤<!-- ≤ --></mo>
<mn>1</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle 0\leq t\leq 1}</annotation>
</semantics>
</math></span><img src="./86496f1001838495964ccca2851a6f29ff0c36a9.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.505ex; width:9.361ex; height:2.343ex;" alt="{\displaystyle 0\leq t\leq 1}" loading="lazy"></span>.
</p><p>Now to find the intersection point with the clipping window, we calculate the value of the <a href="Dot_product" title="Dot product">dot product</a>. Let <span class="nowrap">⁠<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \mathbf {p} _{E}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">p</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>E</mi>
</mrow>
</msub>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \mathbf {p} _{E}}</annotation>
</semantics>
</math></span><img src="./8c7a249772094266a60a037eddc3ab183532bd45.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:2.973ex; height:2.176ex;" alt="{\displaystyle \mathbf {p} _{E}}" loading="lazy"></span>⁠</span> be a point on the clipping plane <span class="nowrap">⁠<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle E}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>E</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle E}</annotation>
</semantics>
</math></span><img src="./4232c9de2ee3eec0a9c0a19b15ab92daa6223f9b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.776ex; height:2.176ex;" alt="{\displaystyle E}" loading="lazy"></span>⁠</span>.
</p><p>Calculate <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \mathbf {n} \cdot (\mathbf {p} (t)-\mathbf {p} _{E})}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">n</mi>
</mrow>
<mo>⋅<!-- ⋅ --></mo>
<mo stretchy="false">(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">p</mi>
</mrow>
<mo stretchy="false">(</mo>
<mi>t</mi>
<mo stretchy="false">)</mo>
<mo>−<!-- − --></mo>
<msub>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">p</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>E</mi>
</mrow>
</msub>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \mathbf {n} \cdot (\mathbf {p} (t)-\mathbf {p} _{E})}</annotation>
</semantics>
</math></span><img src="./e460795b152ab74b19dd0c01bd300a9ab4627712.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.921ex; height:2.843ex;" alt="{\displaystyle \mathbf {n} \cdot (\mathbf {p} (t)-\mathbf {p} _{E})}" loading="lazy"></span>:
</p>
<ul><li>if &lt; 0, vector pointed towards interior;</li>
<li>if = 0, vector pointed parallel to plane containing <span class="nowrap">⁠<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle p}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>p</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle p}</annotation>
</semantics>
</math></span><img src="./81eac1e205430d1f40810df36a0edffdc367af36.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; margin-left: -0.089ex; width:1.259ex; height:2.009ex;" alt="{\displaystyle p}" loading="lazy"></span>⁠</span>;</li>
<li>if &gt; 0, vector pointed away from interior.</li></ul>
<p>Here <span class="nowrap">⁠<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\mathbf {n}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="bold">n</mi>
</mrow>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\mathbf {n}}}</annotation>
</semantics>
</math></span><img src="./8be8da0254fd38956b8a83d20286825bf64bf7fb.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.485ex; height:1.676ex;" alt="{\displaystyle {\mathbf {n}}}" loading="lazy"></span>⁠</span> stands for <a href="Normal_(geometry)" title="Normal (geometry)">normal</a> of the current clipping plane (pointed away from interior).
</p><p>By this we select the point of intersection of line and clipping window where (dot product is 0) and hence clip the line.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://www.slideshare.net/johanna20/clipping-presentation">"Clipping" (presentation)</a>.</span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<p>Algorithms used for the same purpose:
</p>
<ul><li><a href="Cohen%E2%80%93Sutherland_algorithm" title="Cohen–Sutherland algorithm">Cohen–Sutherland algorithm</a></li>
<li><a href="Liang%E2%80%93Barsky_algorithm" title="Liang–Barsky algorithm">Liang–Barsky algorithm</a></li>
<li><a href="Nicholl%E2%80%93Lee%E2%80%93Nicholl_algorithm" title="Nicholl–Lee–Nicholl algorithm">Nicholl–Lee–Nicholl algorithm</a></li>
<li><a href="Fast_clipping" class="mw-redirect" title="Fast clipping">Fast clipping</a></li></ul>
<p>References in other media:
</p>
<ul><li><i><a href="Tron%3A_Uprising" title="Tron: Uprising">Tron: Uprising</a></i></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<ul><li>Mike Cyrus, Jay Beck. "<a rel="nofollow" class="external text" href="https://www.sciencedirect.com/science/article/pii/0097849378900213">Generalized two- and three-dimensional clipping</a>". Computers &amp; Graphics, 1978: 23–28.</li>
<li>James D. Foley. <i><a rel="nofollow" class="external text" href="https://books.google.com/books?id=-4ngT05gmAQC">Computer graphics: principles and practice</a></i>. Addison-Wesley Professional, 1996. p.&nbsp;117.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external free" href="https://web.archive.org/web/20101203041134/http://cs1.bradley.edu/public/jcm/cs535CyrusBeck.html">https://web.archive.org/web/20101203041134/http://cs1.bradley.edu/public/jcm/cs535CyrusBeck.html</a></li>
<li><a rel="nofollow" class="external free" href="https://web.archive.org/web/20110725233122/http://softsurfer.com/Archive/algorithm_0111/algorithm_0111.htm">https://web.archive.org/web/20110725233122/http://softsurfer.com/Archive/algorithm_0111/algorithm_0111.htm</a></li></ul>
<p><br>
</p>
<style data-mw-deduplicate="TemplateStyles:r1271159938">
/* start https://en.wikipedia.org/ */


.mw-parser-output .asbox{position:relative;overflow:hidden}.mw-parser-output .asbox table{background:transparent}.mw-parser-output .asbox p{margin:0}.mw-parser-output .asbox p+p{margin-top:0.25em}.mw-parser-output .asbox-body{font-style:italic}.mw-parser-output .asbox-note{font-size:smaller}.mw-parser-output .asbox .navbar{position:absolute;top:-0.75em;right:1em;display:none}.mw-parser-output :not(p):not(.asbox)+style+.asbox,.mw-parser-output :not(p):not(.asbox)+link+.asbox{margin-top:3em}


/* end https://en.wikipedia.org/ */
</style></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2024-06-01" href="https://en.wikipedia.org/wiki/?title=Cyrus%E2%80%93Beck_algorithm&amp;oldid=1226716332">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>